home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 27.zip / BS1 part 27 / ImageMaster_d3.adf / piarc.lzh.parta / kochr.rexx < prev    next >
OS/2 REXX Batch file  |  1993-03-23  |  2KB  |  84 lines

  1. /*
  2.  * KOCHr.rexx draw a KOCH snowflake in the Image in IM
  3.  *
  4.  *  Written by: Barry Chalmers and Ben Williams
  5.  * Last Update: January 17th, 1992
  6.  *         For: Black Belt Systems image processing series IM, IM F/c, and IP.
  7.  * ---------------------------------------------------------------------------
  8.  *    Revision: 1.01 - see ReadMe file for details on changes to this level
  9.  */
  10. call pragma('stack',20000);
  11.  
  12. /*
  13.  * open rexxsupport.library -- needed for some functions
  14.  */
  15. if ~show('L',"rexxsupport.library") then do
  16.   if addlib('rexxsupport.library',0,-30,0) then do
  17.       /* everything's ok */
  18.     end;
  19.   else do
  20.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  21.     say 'Cannot operate JPEG.rexx without this library - sorry!';
  22.     exit 10;
  23.     end;
  24.   end;
  25.  
  26. /*
  27.  * This will automatically direct the script to the proper
  28.  * software, if it is running. No matter where the script is
  29.  * launched from. :^) I sure do like ARexx. :^))
  30.  */
  31. prtnme = 'IP_Port'; /* assume Image Professional */
  32. if show('P','IP_Port') = 0 then do
  33.   if show('P','IM_Port') = 0 then do
  34.     say "Can't find image processor's ARexx port!!!"; /* not running? */
  35.     say "This script requires IP, IM or IM F/c to run!";
  36.     exit(20);
  37.     end;
  38.   else do
  39.     prtnme = 'IM_Port'; /* That's the thing about assumptions... */
  40.     end;                 /* We make em, user's break em.          */
  41.   end;
  42.  
  43.   /*
  44.    * This code attempts to read a file called "picmdpath" from REXX:
  45.    * If it can't find it, the script will assume that the commands
  46.    * associated with this PI Module are in "c:". If the file exists,
  47.    * the script will look in the path that is specified in the file.
  48.    * If you create this file, you MUST put a complete, correct path
  49.    * in it; if the commands are in a sub-directory, you have to put
  50.    * the trailing slash on the path (like, device:dir/).
  51.    * 
  52.    */
  53.   cmdpath = 'c:';
  54.   if open(fhandle,'rexx:picmdpath','read') then  /* open the file */
  55.     do
  56.       cmdpath = readln(fhandle);
  57.       call close(fhandle);  /* close the file    */
  58.     end
  59.  
  60. address(prtnme);
  61.  
  62. 'wbtofront';
  63.  
  64. options results;
  65. 'jackin';
  66. stuff = result;
  67. 'current';
  68. bufdata = result;
  69. options;
  70. parse var bufdata bname ',' bnum ',' brest
  71.  
  72. 'lockimage '||bnum;
  73. address command cmdpath||'koch '||stuff;
  74. 'unlockimage '||bnum;
  75.  
  76. address(prtnme);
  77.  
  78. 'tofront';
  79. 'redraw';
  80.  
  81. address;
  82.  
  83. exit 0;
  84.